package cn.ronghuanet.controller;

import cn.ronghuanet.domain.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @GetMapping("/userid/{userId}")
    public List<Order> getOrderByUserId(@PathVariable("userId")Long userId){
        // 实际场景中,应该调用service->mapper,从数据库获取,现在测试阶段,先写死
        return Arrays.asList(new Order(1L,"订单1",userId),
                new Order(2L,"订单2",userId),
                new Order(3L,"订单3",userId));
    }

}
